// 导入抽取的axios对象
import request from '../utils/request'
// get请求用params  post请求用data
// 获取面试经验
export function getTechnicList (params) {
  return request({
    url: '/articles/technic',
    method: 'get',
    params
  })
}
// 获取面经列表
export function getShareList (params) {
  return request({
    url: '/articles/share',
    method: 'get',
    params
  })
}
// 面试技巧详情页面
export function getTechDetail (id) {
  return request({
    url: `/articles/technic/${id}`,
    method: 'get'
  })
}

// 点赞文章
export function starArticle (data) {
  return request({
    url: '/articles/star',
    method: 'post',
    needToken: true,
    data
  })
}

// 面经详情页面
export function getShareDetail (id) {
  return request({
    url: `/articles/share/${id}`,
    method: 'get'
  })
}

// 面经评论
export function getShareComments (data) {
  // 解构赋值
  const { id, limit, start } = data
  return request({
    url: `/articles/comments/${id}`,
    method: 'get',
    params: {
      limit,
      start
    }
  })
}
// 发表评论
export function addComments (data) {
  return request({
    url: '/articles/comments',
    method: 'post',
    needToken: true,
    data
  })
}
